package com.liaogui.设计模式.单例模式;

/**
 * 饿汉模式
 * @author liaogui
 * @date 2025/3/27 20:10
 */
public class HungryMan {

    private static final HungryMan instance = new HungryMan();
    private HungryMan() {

    }

    public static HungryMan getInstance() {
        return instance;
    }

    public static void main(String[] args) {
        HungryMan instance1 = HungryMan.getInstance();
        HungryMan instance2 = HungryMan.getInstance();
        System.out.println(instance1 == instance2);
    }
}
